<template>
	<view class="">
		<jyf-parser :html="infoInfo.content"></jyf-parser>
		<!-- <view class="cont-time">
			{{infoInfo.createtime}}
		</view> -->
	</view>
</template>

<script>
import jyfParser from "@/components/jyf-parser/jyf-parser";
export default{
	data(){
		return {
			id:'',
			info:'',
			infoInfo:'',
			mid: 0,
		}
	},
	onLoad(option) {
		if(option.id){
			this.id=option.id
		}
		if(option.mid){
			this.mid = option.id;
		}
		uni.setStorageSync('mid', this.mid);
		uni.showLoading({title:'请稍后'})
		if(!uni.getStorageSync('token')){
			this.getToken();
		}else{
			this.getInfo();
		}
	},
	methods: {
		getToken(){
			// #ifdef MP-WEIXIN
			uni.login({
				provider: 'weixin',
				success:res=> {
					this.$axios('login/autologin','POST','member',{
						mid: this.mid,
						code: res.code
					}).then(res=>{
						if(res.data.code == 200){
							uni.setStorageSync('token', res.data.data);
							uni.setStorageSync('Jh_recotabshops', 1);
							this.getInfo();
							this.getSharePath();
						}
					})
				}
			})
			// #endif
			// #ifdef MP-ALIPAY
			my.getAuthCode({
			    scopes: 'auth_base',
			    success: res => {
					this.$axios('login/autologinAliPay','POST','member',{
						mid: this.mid,
						code: res.authCode
					}).then(res=>{
						if(res.data.code == 200){
							uni.setStorageSync('token', res.data.data);
							uni.setStorageSync('Jh_recotabshops', 1);
							this.getInfo();
							this.getSharePath();
						}
					})
				}
			})
			// #endif
		},
		getInfo(){
			this.$axios('index/msginfo','POST',"salemsg",
				{id:this.id},
			).then(res=>{
				uni.hideLoading();
				if(res.data.code==200){
					this.info=res.data.data;
					this.infoInfo=this.info.info;
					uni.setNavigationBarTitle({title:this.infoInfo.title});
				}else{
					this.$api.msg(res.data.data)
				}
			})
		}
	}
}
</script>

<style>
.cont-time{
	font-size: 32upx;
	color: #303133;
	line-height: 60upx;
	text-align: right;
}
</style>
